package com.wlyuan.open.scanner.utils.enums.transport;

import com.wlyuan.core.marker.NamedValue;
import com.wlyuan.core.marker.NamedValueMap;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Map;

/**
 * @author lijing
 * @description 运单状态对应关系
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum TransportStatusEnum implements NamedValue<Integer> {

    /**
     * 待调度
     */
    WAIT_DISPATCH(1, 10, "待调度"),

    /**
     * 待接收
     */
    WAIT_ACCEPT(100, 21, "待接收"),

    /**
     * 待签收
     */
    WAIT_SIGN(2, 30, "待签收"),

    /**
     * 待回单
     */
    WAIT_RECEIPT(4, 40, "待回单"),

    /**
     * 已回单
     */
    DONE(8, 50, "已回单"),

    /**
     * 已关闭
     */
    CLOSE(32, 60, "已关闭"),

    /**
     * 被拆单
     */
    BE_SPLIT(200, -1, "被拆单"),
    ;

    private final Integer value;
    private final Integer newValue;
    private final String name;

    private static final Map<Integer, TransportStatusEnum> MAP = new NamedValueMap<>(TransportStatusEnum.class);

    public static TransportStatusEnum fromValue(Integer value) {
        return MAP.get(value);
    }

}
